package com.yuhs.zixing.study.design.pattern.dp002.create.c001.singleton;

/**
 * @description 懒汉式 同步方法
 * @author: yuhs
 * @date 2022/3/30 下午3:17
 */
public class SingletonDemo004 {
    private static SingletonDemo004 instance;

    private SingletonDemo004() {
    }

    public static synchronized SingletonDemo004 getInstance() {

        if (instance == null) {
            instance = new SingletonDemo004();
        }
        return instance;

    }
}
